/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.propuesta;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author bigbang
 */
@Entity
@Table(name = "itemcosto")
@NamedQueries({
    @NamedQuery(name = "Itemcosto.findAll", query = "SELECT i FROM Itemcosto i"),
    @NamedQuery(name = "Itemcosto.findByIdItemCosto", query = "SELECT i FROM Itemcosto i WHERE i.idItemCosto = :idItemCosto"),
    @NamedQuery(name = "Itemcosto.findByItem", query = "SELECT i FROM Itemcosto i WHERE i.item = :item")})
public class Itemcosto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idItemCosto")
    private Integer idItemCosto;
    @Size(max = 100)
    @Column(name = "item")
    private String item;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "itemcosto")
    private List<Presupuesto> presupuestoList;
    @OneToMany(mappedBy = "itemcosto")
    private List<Tiporecurso> tiporecursoList;

    public Itemcosto() {
    }

    public Itemcosto(Integer idItemCosto) {
        this.idItemCosto = idItemCosto;
    }

    public Integer getIdItemCosto() {
        return idItemCosto;
    }

    public void setIdItemCosto(Integer idItemCosto) {
        this.idItemCosto = idItemCosto;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public List<Presupuesto> getPresupuestoList() {
        return presupuestoList;
    }

    public void setPresupuestoList(List<Presupuesto> presupuestoList) {
        this.presupuestoList = presupuestoList;
    }

    public List<Tiporecurso> getTiporecursoList() {
        return tiporecursoList;
    }

    public void setTiporecursoList(List<Tiporecurso> tiporecursoList) {
        this.tiporecursoList = tiporecursoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idItemCosto != null ? idItemCosto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Itemcosto)) {
            return false;
        }
        Itemcosto other = (Itemcosto) object;
        if ((this.idItemCosto == null && other.idItemCosto != null) || (this.idItemCosto != null && !this.idItemCosto.equals(other.idItemCosto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.item;
    }
    
}
